<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    .H{
      background-color: palevioletred;
    }
    button{
      width: 100px;
      text-align: center;  
      border: 0;
    }
    .xuan {
      text-align: center;
    }
    #app {width: 300px;height: 500px;}

  </style>
</head>
<!-- 4.  选项卡 -->
<body>
  <div id="app">

    <button @click="activeIndex=0" :class="{'H':activeIndex===0}">银联</button>
    <button @click="activeIndex=1" :class="{'H':activeIndex===1}">支付宝</button>
    <button @click="activeIndex=2" :class="{'H':activeIndex===2}">微信</button>

    <div class="xuan" v-if="activeIndex===0">内容一</div>
    <div class="xuan" v-if="activeIndex===1">内容二</div>
    <div class="xuan" v-if="activeIndex===2">内容三</div>

  </div>``
</body>
<script src="./vue.js"></script>
<script>
  const { createApp ,ref} = Vue;
  createApp({
    setup () {
      let red = ref('H')
      let activeIndex = ref(2)
      return {
        red,
        activeIndex
      }
    }
  }).mount('#app')
</script>
</html>